package com.saml.demo.sp.controller;

import com.saml.demo.sp.utils.IDPMessageDecoder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Derry Luo on 2019/5/6.
 */
@Controller
@RequestMapping("/sp/servicetest")
public class ServiceTestController {

    @RequestMapping("test")
    @ResponseBody
    public String test() {
        return "The service is available.";
    }

    @RequestMapping("index")
    public String indexPage(HttpServletRequest request) throws Exception {
        return "/index";
    }

    @RequestMapping("testDecode")
    public String test(HttpServletRequest request, ModelAndView modelAndView) throws Exception {
        IDPMessageDecoder.decode(request);
        modelAndView.addObject("msg", "ok");
        return "/ok";
    }


}
